<?php
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Origin:*");

$dir = "history";
$list = [];

if (is_dir($dir)) {
    foreach (scandir($dir) as $file) {
        if (strpos($file, ".json") !== false) {
            $list[] = $file;
        }
    }
}

echo json_encode($list);
?>
